﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace ClassManager_StudentCrack._NetWork
{
    /// <summary>
    /// 伪装 Mythware 教师端
    /// </summary>
    class DisMytServer
    {
        public static void Test()
        {
            int[] OONC = {
                0x4f, 0x4f, 0x4e, 0x43, 0x00, 0x00, 0x01, 0x00,
                0x10, 0x00, 0x00, 0x00, 0x19, 0x6d, 0x6a, 0xf9,
                0x29, 0x5b, 0xb9, 0x46, 0xab, 0x95, 0x8a, 0x14,
                0x3e, 0xcd, 0xdc, 0x26, 0xac, 0xa8, 0xd6, 0x01,
                0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00
            };

            int[] CANC = {
                0x43, 0x41, 0x4e, 0x43, 0x00, 0x00, 0x01, 0x00,
                0x54, 0x00, 0x00, 0x00, 0x19, 0x6d, 0x6a, 0xf9,
                0x29, 0x5b, 0xb9, 0x46, 0xab, 0x95, 0x8a, 0x14,
                0x3e, 0xcd, 0xdc, 0x26, 0x01, 0x00, 0x10, 0x00,
                0xac, 0xa8, 0xd6, 0x01, 0x01, 0x00, 0x00, 0x00,
                0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x65, 0x00,
                0x73, 0x00, 0x74, 0x00, 0x31, 0x00, 0x31, 0x00,
                0x31, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x00, 
                0x31, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x00,
                0x31, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x00,
                0x31, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x00,
                0x31, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x00,
                0x31, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x00,
                0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
            };

            byte[] _OONC = new byte[OONC.Length];

            byte[] _CANC = new byte[CANC.Length];

            for (int i = 0; i < OONC.Length; i++)
            {
                _OONC[i] = byte.Parse(OONC[i].ToString());
            }
            for (int i = 0; i < CANC.Length; i++)
            {
                _CANC[i] = byte.Parse(CANC[i].ToString());
            }


            UdpClient client = new UdpClient(new IPEndPoint(IPAddress.Parse("172.168.214.1"), 55555));
            client.JoinMulticastGroup(IPAddress.Parse("224.0.0.22"));
            IPEndPoint end = new IPEndPoint(IPAddress.Parse("224.50.50.42"), 4705);
            client.Send(_OONC, _OONC.Length, end);
            client.Send(_CANC, _CANC.Length, end);
        }
    }
}
